#define _CRT_SECURE_NO_WARNINGS 1
class Solution {
public:
    int findNumberOfLIS(vector<int>& nums) {
        int n = nums.size();
        vector<int> len(n, 1), count(n, 1);
        for (int i = 1; i < nums.size(); i++)
        {
            for (int j = 0; j < i; j++)
            {
                if (nums[j] < nums[i])
                {
                    if (len[j] + 1 == len[i]) count[i] += count[j];
                    else if (len[j] + 1 > len[i]) count[i] = count[j], len[i] = len[j] + 1;
                }
            }
        }
        int countret = 0, lenret = 0;
        for (int i = 0; i < n; i++)
        {
            if (lenret == len[i]) countret += count[i];
            else if (lenret < len[i]) lenret = len[i], countret = count[i];
        }
        return countret;
    }
};